
//LEGAL DISCLAIMER:
//IMPORTANT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//If you add or keep TABLES or TABLE REFERENCES to this table, YOUR SERVER WILL BE HACKED, YOUR HARDDRIVE WILL BE ERASED, AND YOUR PROCESSOR WILL BE OVERCLOCKED RESULTING IN SEVERE HARDWARE DAMAGE*
//THE ODDS OF ME REMOVING THESE COMMENTS BEFORE SOMEONE POSTS THEM ON FACEPUNCH LIKE A TOTAL NOOB IS SLIM.*
//ANY GRAMMAR NAZIS THAT POINT OUT THAT THE ABOVE USAGE OF "IS" IS INCORRECT WILL RECEIVE A HARD-CODED STEAMID BAN*

luachip.library = {
	hook = true, //Set variables to true that used in the metalibrary so that the client doesn't localize them when trying to use them
	hookmeta = function(event_name,f)
		luachip.metaHook(event_name,f)
	end,
}

luachip.metaglobals = {}

luachip.metalibrary = {
	hook = [[
local hook = {}
do
	local hooks = {}
	
	hook.Add = function(event,name,f)
		if not hooks[event] then
			hooks[event] = {}
		end
		hooks[event][name] = f
	end
	
	hook.Remove = function(event,name)
		hook.Add(event,name)
	end
	
	hook.Call = function(event,...)
		if hooks[event] then
			for k,v in pairs(hooks[event]) do
				v(unpack(arg))
			end
		end
	end
	
	luachip.metaHook('Think',function() hook.Call('Think') end)
	luachip.metaHook('ConsoleUpdate',function() hook.Call('ConsoleUpdate') end)
	luachip.metaHook('PlayerUse',function(plid) hook.Call('PlayerUse',plid) end)
end
]],
}

do
	local rec
	rec = function(tab,dat)
		if type(dat) == "table" then
			for k,v in pairs(dat) do
				if type(v) == "string" then
					tab[k] = v
				elseif type(v) == "table" then
					if not tab[k] then
						tab[k] = {}
					end
					
					rec(tab[k],v)
				end
			end
		end
	end
	
	for k,v in pairs(file.FindInLua(luachip.dir.."/libraries/*.lua")) do
		library = {}
		execute = nil
		variable = {}
		include(luachip.dir.."/libraries/"..v)
		
		for k,v in pairs(variable) do
			luachip.library[k] = v
		end
		rec(luachip.metaglobals,library)
		luachip.metalibrary[luachip.dir.."/libraries/"..v] = execute
	end
end


//*Just kidding (Note the failure to specify what I am kidding about. I may define what this refers to in court at my own discretion. Position of asterisk(s) may or may not be unrelated to what it/they actually reference(s). Asterisk(s) may reference to a license agreement that may be made and/or changed at any time in the future, and by using this software, you agree in full to the license that I may or may not have written yet/already. By using this software, you freely withdraw all of your amendment rights and allow the author to decide which presidential candidates you will vote for.)**

//** See *(**)
